/* 全局样式变量 */
:root {
  --primary: #3b82f6;
  --accent: #6366f1;
  --background: #ffffff;
  --surface: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-soft: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --orange: #f97316;
  --green: #10b981;
  --neon-green: #39ff14;
}

/* 全局样式重置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--background);
}

/* 顶部导航 */
header {
  background-color: var(--surface);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

header .flex.items-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(to right, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header button {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-primary);
}

header button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

header button i {
  margin-right: 0.5rem;
  color: var(--primary);
}

/* 移动端菜单 */
#mobileMenu {
  border-top: 1px solid var(--border);
}

#mobileMenu .container {
  padding: 0.5rem 1rem;
}

#mobileMenu button {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

/* 主内容区 */
main {
  padding: 1.5rem 1rem;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.lg\:grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lg\:col-span-2 {
  grid-column: span 2 / span 2;
}

/* 卡片样式 */
.bg-white {
  background-color: var(--surface);
}

.rounded-xl {
  border-radius: 0.75rem;
}

.shadow-soft {
  box-shadow: var(--shadow-soft);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.p-6 {
  padding: 1.5rem;
}

.hover\:shadow-lg:hover {
  box-shadow: var(--shadow-lg);
}

.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
}

/* 标题样式 */
h2.text-lg {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}

h2.text-lg i {
  margin-right: 0.5rem;
  color: var(--primary);
}

/* 表单样式 */
.space-y-4 {
  gap: 1rem;
}

label.block {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  outline: none;
  transition: all 0.2s;
  background-color: var(--background);
  color: var(--text-primary);
  font-family: monospace;
}

/* 处理textarea中的tab键缩进 */
textarea {
  -moz-tab-size: 2;
  -o-tab-size: 2;
  tab-size: 2;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-color: var(--primary);
}

textarea.resize-none {
  resize: none;
}

/* 按钮样式 */
.flex.justify-end {
  display: flex;
  justify-content: flex-end;
}

/* 橙色按钮样式 */
.bg-orange {
  background-color: var(--orange);
}

.bg-orange:hover:not(:disabled) {
  background-color: rgba(249, 115, 22, 0.9);
}

.bg-neon-green {
  background-color: var(--neon-green);
  color: black;
}

.bg-neon-green:hover:not(:disabled) {
  background-color: rgba(57, 255, 20, 0.9);
  color: black;
}

/* 绿色按钮样式 */
.bg-green {
  background-color: var(--green);
}

.bg-green:hover:not(:disabled) {
  background-color: rgba(16, 185, 129, 0.9);
}

/* 浅粉红色按钮样式 */
.bg-light-pink {
  background-color: #f9a8d4;
}

.bg-light-pink:hover:not(:disabled) {
  background-color: rgba(249, 168, 212, 0.9);
}

/* 按钮禁用状态 */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#saveDocumentBtn,
#searchBtn {
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

#saveDocumentBtn {
  background-color: var(--primary);
  box-shadow: var(--shadow);
}

#saveDocumentBtn:hover {
  background-color: rgba(59, 130, 246, 0.9);
}

#searchBtn {
  background-color: var(--accent);
  box-shadow: var(--shadow);
  padding: 0.5rem 1rem;
}

#searchBtn:hover {
  background-color: rgba(99, 102, 241, 0.9);
}

/* 搜索区域 */
.flex.space-x-2 {
  display: flex;
  gap: 0.5rem;
}

.flex-1 {
  flex: 1 1 0%;
  min-width: 200px; /* 确保搜索框有足够宽度 */
}

#searchQuery {
  min-width: 350px; /* 增大搜索输入框最小宽度 */
  padding: 0.625rem 1rem; /* 增加内边距使搜索框更易使用 */
  font-size: 1rem; /* 确保字体大小合适 */
}

#searchCategory {
  min-width: 150px; /* 增大分类选择框最小宽度 */
  padding: 0.625rem 1rem; /* 增加内边距 */
  font-size: 1rem;
}

/* 搜索结果 */
#searchResults {
  gap: 1rem;
  max-height: 24rem;
  overflow-y: auto;
}

#searchResults > div {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  transition: all 0.2s;
  cursor: pointer;
}

#searchResults > div:hover {
  box-shadow: var(--shadow);
}

.flex.justify-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.font-medium.text-lg {
  font-weight: 500;
  font-size: 1.125rem;
}

.text-xs {
  font-size: 0.75rem;
}

.bg-green-100 {
  background-color: #dcfce7;
}

.text-green-800 {
  color: #15803d;
}

.px-2 {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.py-1 {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.rounded-full {
  border-radius: 9999px;
}

/* 分类标签 */
.flex.flex-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.bg-blue-100 {
  background-color: #dbeafe;
}

.text-blue-800 {
  color: #1e40af;
}

/* 文本摘要 */
.markdown-preview {
  line-height: 1.5;
  color: var(--text-secondary);
}

/* 模态框过渡动画 */
.modal-enter-active, .modal-leave-active {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal-enter-from, .modal-leave-to {
  opacity: 0;
  transform: scale(0.95);
}

/* 响应式设计 */
.hidden {
  display: none;
}

.md\:flex {
  display: flex;
}

.md\:hidden {
  display: none;
}

@media (min-width: 768px) {
  .md\:hidden {
    display: none;
  }
  
  .hidden.md\:flex {
    display: flex;
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .lg\:col-span-2 {
    grid-column: span 2 / span 2;
  }
}